home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / bat.zip / FORMAT.BAT < prev    next >
DOS Batch File  |  1984-03-07  |  4KB  |  125 lines

  1. bat * working * (to be used with ANSI.SYS device driver in DOS 2.0)
  2. bat goto -start
  3. bat -field %o = 0
  4. bat type %l %a %l ;
  5. bat inkey %1 | %0 = %1 # | if %0 = 1 skip 5
  6. bat if %1 = key009 %n = %n + 1 | return
  7. bat if %1 = key10f %n = %n - 1 | return
  8. bat if %1 = key00d %o = 1 | return
  9. bat if %1 = key01b cls | exit
  10. bat beep | goto -field
  11. bat %a = %1
  12. bat  type %lk ;
  13. bat skip 11
  14. bat -fielda inkey %1 | %0 = %1 # | if %0 = 1 skip 9
  15. bat if %1 = key009 %n = %n + 1 | return
  16. bat if %1 = key10f %n = %n - 1 | return
  17. bat if %1 = key00d %o = 1 | return
  18. bat if %1 = key01b cls | exit
  19. bat if %1 <> key008 beep | goto -fielda
  20. bat %0 = %a # | if %0 = 0 beep | goto -fielda
  21. bat %0 = %0 - 1 | %a = %a $ 1 %0
  22. bat type %lk %a ;
  23. bat goto -fielda
  24. bat %a = %a%1
  25. bat %0 = %a # | type %l %a ;
  26. bat if %0 < %m goto -fielda
  27. bat %n = %n + 1 | return
  28. bat -menu cls
  29. bat begtype
  30.  
  31.              FORMAT
  32.  
  33.      File:
  34.  
  35.      Pages:
  36.  
  37.      To:
  38.  
  39.      Left margin override:
  40.  
  41.      Pause at page-break :
  42. end
  43. bat type 6H %c
  44. bat type 3H %d
  45. bat type 31H %e
  46. bat type 31H %f
  47. bat %a =
  48. bat -field1  %n = 1 | %l = 6H
  49. bat %a = %b | %m = 14 | call -field
  50. bat %b = %a | if %o = 0 goto -field%n
  51. bat goto -process
  52. bat -field2 %n = 2 | %l = 6H
  53. bat %a = %c | %m = 14 | call -field
  54. bat %c = %a | if %o = 0 goto -field%n
  55. bat goto -process
  56. bat -field3 %n = 3 | %l = 3H
  57. bat %a = %d | %m = 1 | call -field
  58. bat %d = %a $ 1 1
  59. bat if .%d = .s %d = screen | skip 2
  60. bat if .%d = .p %d = printer | skip 1
  61. bat %d = screen | beep | goto -field3
  62. bat type %l %d | if %o = 0 goto -field%n
  63. bat goto -process
  64. bat -field4 %n = 4 | %l = 31H
  65. bat %a = %e | %m = 2 | call -field
  66. bat %e = %a | if %o = 0 goto -field%n
  67. bat goto -process
  68. bat -field5 %n = 5 | %l = 31H
  69. bat %a = %f | %m = 1 | call -field
  70. bat %f = %a $ 1 1
  71. bat if .%f = .n %f = no | skip 2
  72. bat if .%f = .y %f = yes | skip 1
  73. bat %f = no | beep | goto -field5
  74. bat type %l %f | if %o = 0 goto -field%n
  75. bat goto -process
  76. bat -field0  goto -field1
  77. bat -field6  goto -field5
  78. bat -start %b =
  79. bat %c = 1-99
  80. bat %d = Screen
  81. bat %e = NO
  82. bat %f = NO
  83. bat %0 = %1 # | if %0 = 0 goto -menu
  84. bat %b = %1
  85. bat -parse %1 = %2 | %2 = %3 | %3 = %4 | %4 = %5 | %5 = %6 | %6 = %7 | %7 =
  86. bat %0 = %1 # | if %0 = 0 goto -process
  87. bat if %1 = printer %d = printer | goto -parse
  88. bat if %1 = screen  %d = screen | goto -parse
  89. bat if %1 = pause %f = yes | goto -parse
  90. bat %0 = %1 $ 1 5 | if %0 <> pages skip 2
  91. bat %c = %2 | %1 = %2 | %2 = %3 | %3 = %4
  92. bat %4 = %5 | %5 = %6 | %6 = | goto -parse
  93. bat %0 = %1 $ 1 4 | if %0 <> left skip 2
  94. bat %e = %2 | %1 = %2 | %2 = %3 | %3 = %4
  95. bat %4 = %5 | %5 = %6 | %6 = | goto -parse
  96. bat type syntax error: %1
  97. bat type use:
  98. bat type format file screen/printer pages=nn left=nn pause
  99. bat exit
  100. bat -process %0 = %b # | if %0 <> 0 skip 2
  101. bat cls | type filename is required
  102. bat inkey hit any key to continue ... | goto -menu
  103. bat stateof %b | if %r <> 9 skip 2
  104. bat cls | type invalid file name: %b
  105. bat %b = | inkey hit any key to continue ... | goto -menu
  106. bat if %r <> 1 skip 2
  107. bat cls | type file %b not found
  108. bat inkey hit any key to continue ... | goto -menu
  109. bat %0 = %b # | %1 = %b $ %0 1 | if .. = .%1 %0 = %0 - 1 | %b = %b $ 1 %0
  110. bat cls
  111. bat type %%b = file = %b
  112. bat type %%c = pages = %c
  113. bat type %%d = dest = %d
  114. bat type %%e = lmo = %e
  115. bat type %%f = pause = %f
  116. bat if %d = screen %d = | skip 1
  117. bat %d = -de.dvc
  118. bat if %c = 1-99 %c = | skip 1
  119. bat %c = -s%c
  120. bat if %e = no %e = | skip 1
  121. bat %e = -o%e
  122. bat if %f = no %f = | skip 1
  123. bat %f = -p
  124. bat stack rem wordix %d %c %e %f %b
  125.